<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>城市添加</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
  <link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" />
  <style type="text/css">
    .site-doc-icon li{
      display: inline-block;
      vertical-align: middle;
      width: 127px;
      line-height: 25px;
      padding: 20px 0;
      margin-right: -1px;
      margin-bottom: -1px;
      border: 1px solid #e2e2e2;
      font-size: 14px;
      text-align: center;
      color: #666;
      transition: all .3s;
      -webkit-transition: all .3s;
    }
  </style>
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
  <input type="hidden" id="id" value="${device.id}" />
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">城市</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input"  id="city" name="city" value="${device.nowCity}" placeholder="请输入城市名称" lay-verify="required">
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <div class="layui-input-block">
      <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="btnSubmit">确定</button>
      <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary closeLay">取消</button>
    </div>
  </div>
</form>
<ul class="site-doc-icon icons layui-row">
</ul>

<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script src="${s.base}/base/js/jquery-3.2.0.min.js"></script>
<script type="text/javascript">
    layui.use(['form','layer'],function(){
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery;
        form.on("submit(btnSubmit)",function(data){
            //弹出loading
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            // 实际使用时的提交信息
            var city=$("#city").val();
            if(city==null||city==""){
                top.layer.msg("请填写城市信息");
                return false;
            }

            $.post("/phone/updateCity",{
                id : $("#id").val(),
                city : city
            },function(result){
                if(1==result.returnInfo.state){
                    layer.close(index);
                    top.layer.msg("设置成功！");
                    parent.layer.closeAll("iframe");
                    //刷新父页面
                    //parent.location.reload();
                }else{
                    top.layer.msg(result.returnInfo.errorMsg);
                }
            },"json")
            return false;
        });
    })
</script>
</body>
</html>